package com.parkinglot.controller;

import com.parkinglot.core.Result;
import com.parkinglot.parmeter.AdvertqueryParm;
import com.parkinglot.parmeter.OrderqueryParm;
import com.parkinglot.pojo.MonthbilRecord;
import com.parkinglot.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("managegcenter")
@Api(tags = "后台管理中心数据")
@Slf4j
public class ManageCenterCtr {

    @Resource
    private OrderService orderService;
    @Resource
    private GarageService garageService ;
    @Resource
    private MonthbilRecordService monthbilRecordService;
    @Resource
    private UserService userService;
    @Resource
    private AdvertRecordService advertRecordService;

    @ApiOperation(value = "活跃车排行统计各个车库昨日停车总数")
    @GetMapping("/getcountgaragestopcar")
    public Result countgaragecar(){
        return Result.success(orderService.countgaragecars());
    }


    @ApiOperation(value = "某个车库或者全部车库总收益")
    @GetMapping("/garagemoney")
    public Result garagemoney(OrderqueryParm orderqueryParm){
        return Result.success(orderService.garagemoney(orderqueryParm));
    }

    @ApiOperation(value = "某个车库或者全部车库车辆总数")
    @GetMapping("/getcountcar")
    public Result countcar(OrderqueryParm orderqueryParm){
        return Result.success(orderService.countcar(orderqueryParm));
    }
    @ApiOperation(value = "查询所有停车场")
    @GetMapping("/getallgarage")
    public Result allgarage(){
        return Result.success(garageService.allgarage());
    }

    @ApiOperation(value = "中心数据昨日收益统计")
    @GetMapping("/getgarageyesterdayprofitmoney")
    public Result getgarageyesterdayprofitmoney(){
        return Result.success();
    }
    @ApiOperation(value = "全部车库上周每天收入统计（主要统计全部车库上一周每天收入汇总金额）")
    @GetMapping("/allgarageweekmoney")
    public Result allgarageweekmoney( ){
        return Result.success(orderService.allgarageweekmoney());
    }

    @ApiOperation(value = "全部车库上月每天收益统计")
    @GetMapping("/garagemonth")
    public Result garagemonth(OrderqueryParm orderqueryParm){
        return Result.success(orderService.garagemonth(orderqueryParm));
    }

    @ApiOperation(value = "全部车库昨日收入统计")
    @GetMapping("/countgaraagemoney")
    public Result countgaraagemoney(OrderqueryParm orderqueryParm){
        return Result.success(orderService.countgaraagemoney(orderqueryParm));
    }

    @ApiOperation(value = "统计所有会员数量")
    @GetMapping("/countvip")
    public Result countvip(MonthbilRecord monthbilRecord){
        return Result.success(monthbilRecordService.countvip(monthbilRecord));
    }
    @ApiOperation(value = "所有用户或某个车库下所有用户上个月新增趋势")
    @GetMapping("/usermonthcount")
    public Result usermonthcount(String gardecode){
        return Result.success(userService.usermonthcount(gardecode));
    }

    @ApiOperation(value = "用户新增趋势昨日(目前按照每小时统计)")
    @GetMapping("/userzrcount")
    public Result userzrcount(){
        return Result.success(userService.userzrcount());
    }

    @ApiOperation(value = "所有用户或某个车库下所有用户上周新增趋势(目前按照每天统计)")
    @GetMapping("/userweekcount")
    public Result userweekcount(String gardecode){
        return Result.success(userService.userweekcount(gardecode));
    }

    @ApiOperation(value = "所有广告投放数或某个车库广告投放数")
    @GetMapping("/countadvert")
    public Result countadvert(AdvertqueryParm advertqueryParm){
        return Result.success(advertRecordService.countadvert(advertqueryParm));
    }

}
